# +----------------------------------------------------------------------
# | ChatWork智能聊天办公系统
# +----------------------------------------------------------------------
# | 软件声明: 本系统并非自由软件,未经授权任何形式的商业使用均属非法。
# | 版权保护: 任何企业和个人不允许对程序代码以任何形式任何目的复制/分发。
# | 授权要求: 如有商业使用需求,请务必先与版权所有者取得联系并获得正式授权。
# +----------------------------------------------------------------------
# | Author: ChatWork Team <2474369941@qq.com>
# +----------------------------------------------------------------------
from typing import Union, Dict


class WalletEnum:
    # 场景
    POINTS = "points"
    TRAIN = "train"
    ROBOT = "robot"
    KNOW = "know"
    MCP = "mcp"

    """ 积分数 """
    POINTS_DEC_ADMIN = 11001        # 管理平台扣减积分
    POINTS_DEC_RECHARGE = 11002     # 充值退款扣减积分
    POINTS_DEC_SUBSCRIBE = 11003    # 订阅退款扣减积分
    POINTS_DEC_AGENT_CHAT = 11010   # 应用对话消耗积分
    POINTS_DEC_AGENT_EMB = 11011    # 知识训练消耗积分
    POINTS_DEC_AGENT_QA = 11012     # 知识拆分消耗积分
    POINTS_DEC_DOCS_CHAT = 11020    # 畅阅对话消耗积分
    POINTS_DEC_DRAWS = 11021        # AI绘画消耗积分
    POINTS_DEC_VIDEO = 11022        # AI视频消耗积分
    POINTS_DEC_MUSIC = 11023        # AI音乐消耗积分
    POINTS_INC_ADMIN = 15001        # 管理平台增加积分
    POINTS_INC_RECHARGE = 15002     # 充值账户增加积分
    POINTS_INC_SUBSCRIBE = 15003    # 订阅会员赠送积分
    POINTS_INC_REG_REWARD = 15004   # 注册账号赠送积分
    POINTS_INC_DRAWS_FAIL = 15005   # AI绘画失败退积分
    POINTS_INC_VIDEO_FAIL = 15006   # AI视频失败退积分
    POINTS_INC_MUSIC_FAIL = 15007   # AI音乐失败退积分

    """ 训练组 """
    TRAIN_DEC_ADMIN = 21001       # 管理平台扣减训练组
    TRAIN_DEC_RECHARGE = 21002    # 充值退款扣减训练组
    TRAIN_INC_ADMIN = 25001       # 管理平台增加训练组
    TRAIN_INC_RECHARGE = 25002    # 充值账户增加训练组
    TRAIN_INC_REG_REWARD = 25003  # 注册账号赠送训练组

    """ 智能体 """
    ROBOT_DEC_ADMIN = 31001       # 管理平台扣减智能体
    ROBOT_DEC_RECHARGE = 31002    # 充值退款扣减智能体
    ROBOT_INC_ADMIN = 35001       # 管理平台增加智能体
    ROBOT_INC_RECHARGE = 35002    # 充值账户增加智能体
    ROBOT_INC_REG_REWARD = 35003  # 注册账号赠送智能体

    """ 知识库 """
    KNOW_DEC_ADMIN = 41001        # 管理平台扣减知识库
    KNOW_DEC_RECHARGE = 41002     # 退款扣减充值知识库
    KNOW_INC_ADMIN = 45001        # 管理平台扣减知识库
    KNOW_INC_RECHARGE = 45002     # 充值账户增加知识库
    KNOW_INC_REG_REWARD = 45003   # 注册账号赠送知识库

    """ MCP """
    MCP_DEC_ADMIN = 51001       # 管理平台扣减MCP
    MCP_DEC_RECHARGE = 51002    # 退款扣减充值MCP
    MCP_INC_ADMIN = 55001       # 管理平台扣减MCP
    MCP_INC_RECHARGE = 55002    # 充值账户增加MCP
    MCP_INC_REG_REWARD = 55003  # 注册账号赠送MCP

    @classmethod
    def get_change_type_msg(cls, code, scene: str = None) -> Union[str, Dict[int, str]]:
        # 积分
        _POINTS = {
            cls.POINTS_DEC_ADMIN: "管理平台扣减积分",
            cls.POINTS_DEC_RECHARGE: "充值退款扣减积分",
            cls.POINTS_DEC_SUBSCRIBE: "订阅退款扣减积分",
            cls.POINTS_DEC_AGENT_CHAT: "应用对话消耗积分",
            cls.POINTS_DEC_AGENT_EMB: "知识训练消耗积分",
            cls.POINTS_DEC_AGENT_QA: "知识拆分消耗积分",
            cls.POINTS_DEC_DOCS_CHAT: "畅阅对话消耗积分",
            cls.POINTS_DEC_DRAWS: "AI绘画消耗积分",
            cls.POINTS_DEC_VIDEO: "AI视频消耗积分",
            cls.POINTS_DEC_MUSIC: "AI音乐消耗积分",
            cls.POINTS_INC_ADMIN: "管理平台增加积分",
            cls.POINTS_INC_RECHARGE: "充值账户增加积分",
            cls.POINTS_INC_SUBSCRIBE: "订阅会员赠送积分",
            cls.POINTS_INC_REG_REWARD: "注册账号赠送积分",
            cls.POINTS_INC_DRAWS_FAIL: "AI绘画失败退积分",
            cls.POINTS_INC_VIDEO_FAIL: "AI视频失败退积分",
            cls.POINTS_INC_MUSIC_FAIL: "AI音乐失败退积分",
        }

        # 训练组
        _train = {
            cls.TRAIN_DEC_ADMIN: "管理平台扣减训练组",
            cls.TRAIN_DEC_RECHARGE: "充值退款扣减训练组",
            cls.TRAIN_INC_ADMIN: "管理平台增加训练组",
            cls.TRAIN_INC_RECHARGE: "充值账户增加训练组",
            cls.TRAIN_INC_REG_REWARD: "注册账号赠送训练组",
        }

        # 智能体
        _robot = {
            cls.ROBOT_DEC_ADMIN: "管理平台扣减智能体数",
            cls.ROBOT_DEC_RECHARGE: "充值退款扣减智能体数",
            cls.ROBOT_INC_ADMIN: "管理平台增加智能体数",
            cls.ROBOT_INC_RECHARGE: "充值账户增加智能体数",
            cls.ROBOT_INC_REG_REWARD: "注册账号赠送智能体数",
        }

        # 知识库
        _know = {
            cls.KNOW_DEC_ADMIN: "管理平台扣减知识库数",
            cls.KNOW_DEC_RECHARGE: "退款扣减充值知识库数",
            cls.KNOW_INC_ADMIN: "管理平台扣减知识库数",
            cls.KNOW_INC_RECHARGE: "充值账户增加知识库数",
            cls.KNOW_INC_REG_REWARD: "注册账号赠送知识库数",
        }

        # MCP
        _mcp = {
            cls.MCP_DEC_ADMIN: "管理平台扣减MCP数",
            cls.MCP_DEC_RECHARGE: "退款扣减充值MCP数",
            cls.MCP_INC_ADMIN: "管理平台扣减MCP数",
            cls.MCP_INC_RECHARGE: "充值账户增加MCP数",
            cls.MCP_INC_REG_REWARD: "注册账号赠送MCP数",
        }

        # 合并数据
        _desc = {**_POINTS, **_train, **_robot, **_know}

        if isinstance(code, bool) and code:
            if scene == cls.POINTS:
                return _POINTS
            elif scene == cls.TRAIN:
                return _train
            elif scene == cls.ROBOT:
                return _robot
            elif scene == cls.KNOW:
                return _know
            elif scene == cls.MCP:
                return _mcp
            return _desc
        return _desc.get(code, "")
